<template>
  <div class="page-title">
    <div class="title">
      {{title}}
    </div>

    <div>
      <Button
        class="btn"
        type="primary"
        @click="handlebutton(btnName)"
        v-if="btnName"
      >{{name}}</Button>
      <Button
        @click="clearSearch(btnClear)"
        class="clear-search"
        v-if="btnClear"
      >清除搜索</Button>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: ""
    },
    name: {
      type: String,
      default: ""
    },
    btnName: {
      type: String,
      default: ""
    },
    btnClear: {
      type: String,
      default: ""
    }
  },
  methods: {
    handlebutton(btn) {
      this.$emit(btn);
    },
    clearSearch(btn) {
      this.$emit(btn);
    }
  }
};
</script>
<style lang="less" scoped>
@import "~@/styles/mixin";
.page-title {
  .flex(space-between, center);
  .title {
    color: @default-color;
    font-size: 18px;
    font-family: SourceHanSansCN-Medium, SourceHanSansCN;
    font-weight: 500;
  }
}
.clear-search {
  margin-left: 10px;
}
</style>